﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Optimus
{
    public class RTC:BusIO 
    {
        //IRQ8 Works
        public static void Init()
        {
            //Primary Controller
            Cosmos.Core.INTs.SetIrqHandler(0x08, HandleIRQ); ;
            Write8(0x70, 0x8B);//Enable IRQs
            byte prev = Read8(0x71);
            Write8(0x70,0x8B);
            Write8(0x71, (byte)(prev | 0x40));
        }

        public static void HandleIRQ(ref Cosmos.Core.INTs.IRQContext aContext)
        {

            Write8(0x70, 0x0C);
            Read8(0x71);
        }
    }
}
